import * as vscode from "vscode";
import { showErrorMessage } from "@ap/util/vscode/message";
import { userCenterToolItems, CommandId } from "@ap/command";

// 对用户操作进行处理的函数
export const userCenterToolShowBar = async () => {
  try {
    const selectedOption = await vscode.window.showQuickPick(
      userCenterToolItems,
      {
        title: "ArenaPro",
        matchOnDescription: true,
        canPickMany: false,
      },
    );

    if (selectedOption && selectedOption.command) {
      vscode.commands.executeCommand(selectedOption.command);
    }
  } catch (error) {
    // 处理可能的用户取消操作或其他异常
    showErrorMessage(`选择操作遇到错误: ${error}`);
  }
};
